@import '../../style/themes/index';
@import './mixin.less';
@anchor-prefix-cls: ~'@{kd-prefix}-anchor';

.@{anchor-prefix-cls} {
  position: relative;
  padding-left: @anchor-link-left;
  box-sizing: border-box;
  background: @anchor-bg;
  z-index: @zIndex-popper;

  &-wrapper {
    overflow: auto;
    font-size: @anchor-font-size;
    width: @anchor-width;
  }

  &-menu {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    color: #666;

    &-wrapper {
      overflow: auto;
      font-size: @anchor-font-size;
    }

    &-left-arrows {
      margin-right: 10px;
      font-size: @anchor-icon-font-size;
      color: #666;
      cursor: pointer;
      &:hover:not(&-disabled) {
        color: @anchor-color-theme;
      }
      .disabled;
    }

    &-right-arrows {
      margin-left: 10px;
      font-size: @anchor-icon-font-size;
      color: #666;
      cursor: pointer;
      &:hover:not(&-disabled) {
        color: @anchor-color-theme;
      }
      .disabled;
    }

    &-wrap {
      overflow: hidden;
      position: relative;
      flex-grow: 1;
      height: 22px;
    }

    &-link-list {
      // display: flex;
      display: inline-block;
      white-space: nowrap;
      position: absolute;
      transition: all @anchor-transition-duration cubic-bezier(0.42, 0, 1, 1);
      left: 0;
      top: 0;
    }

    .@{anchor-prefix-cls}-link {
      padding: 0;
      display: inline-block;
      &-title {
        display: inline-block;
        max-width: @anchor-horizontal-link-max-width;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        padding: 0 4px;
        line-height: 1.5;
        vertical-align: middle;
      }
    }

    .@{anchor-prefix-cls}-link:not(:last-of-type)::after {
      display: inline-block;
      content: '';
      height: 0;
      width: 40px;
      border-bottom: @anchor-line-slider-width dashed @anchor-disabled-border-color;
      margin: 4px;
    }
  }

  &-advanced-arrows {
    color: @anchor-advanced-arrows-color;
    font-size: @anchor-advanced-arrows-font-size;
    cursor: pointer;
    &:hover {
      color: @anchor-color-theme;
    }
  }

  &-advanced {
    padding-top: @anchor-advanced-padding-top;
    padding-bottom: @anchor-advanced-padding-bottom;
    position: relative;
    box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.08);
    background: @anchor-bg;
    z-index: @zIndex-popper;

    .@{anchor-prefix-cls}-wrapper {
      width: @anchor-advanced-width;
    }

    &-lock {
      display: flex;
      justify-content: flex-end;
      padding: 0 8px 8px 0;
      font-size: @anchor-advanced-lock-size;
      color: @anchor-advanced-arrows-color;
      cursor: pointer;
    }

    .@{anchor-prefix-cls} {
      max-width: @anchor-advanced-width;
    }
  }

  &-line {
    position: absolute;
    left: @anchor-link-left;
    top: 0;
    height: 100%;
    &::before {
      position: relative;
      display: block;
      width: @anchor-line-slider-width;
      height: 100%;
      margin: 0 auto;
      background-color: @anchor-border-color;
      content: '';
    }

    &-slider {
      position: absolute;
      display: none;
      width: 0;
      height: 16px;
      border-right: @anchor-line-slider-width solid @anchor-color-theme;
      transition: top 0.3s ease-in-out;
      &.visible {
        display: inline-block;
      }
    }
  }

  &-link {
    padding: @anchor-link-padding;

    & > .@{anchor-prefix-cls}-link {
      padding: @anchor-link-secondary-padding;
    }

    &-title {
      text-decoration: none;
      color: @anchor-primary-text-color;
      margin-bottom: @anchor-link-top;
      display: block;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      line-height: 1.5;
      cursor: pointer;
      &:only-child {
        margin-bottom: 0;
      }
      &-secondary {
        color: @anchor-secondary-text-color;
        padding-left: 4px;
      }
    }

    &-title:hover {
      color: @anchor-color-theme;
    }

    &-active > &-title {
      color: @anchor-color-theme;
    }
  }

  &-lock {
    font-size: @anchor-icon-font-size;
  }

  &.hidden {
    opacity: 0;
    visibility: hidden;
    transition: all calc(@anchor-transition-duration - 0.1s) cubic-bezier(0.4, 0, 0.6, 1);
  }
}
